// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'

import util from '@/assets/js/util'
window.UT = new util()

import Http from '@/services/httpService'
import router from './router'
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css'
Vue.use(Mint);
Vue.prototype.$http = Http
Vue.config.productionTip = false

Vue.prototype.$CheckUser = () => {
  return new Promise((resolve, reject) => {
    if (UT.isEmpty(UT.getSessionJson('CUR_USER'))) {
      Mint.MessageBox.confirm('请先登录').then(() => {
        location.hash = '#/login'
        // reject()
      }).catch(() => { });
    } else {
      resolve()
    }
  })
}

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
